# 导入模块
import unittest
from common.base_s import get_driver,By, Base
import time
from page.checkout_page import CheckoutPage
from page.login_page import LoginPage

# 创建登录页面测试
class TestCheckout(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:

        cls.Personal = CheckoutPage(get_driver())  # 实例化浏览器
        cls.Personal.login_user()  # 实现登录


    def test_checkout_01(self):
        self.Personal.user_center()  # 点击用户中心

        time.sleep(3)
        # 点击我的订单
        self.Personal.my_order()
        time.sleep(3)
        # 点击再次购买
        self.Personal.buy_again()


        # 结算
        self.Personal.settlement()
        # 选购物方式
        self.Personal.bank_remittance()
        # 提交
        self.Personal.submit_an_order()

        # express = self.Personal.generate_order_express()  # 快递
        # self.assertEqual(express, '申通快递')  # 断言是否是申通快递

        number = self.Personal.generate_order_number()
        number = number[:4]

        self.assertEqual(number, '2023')

        # money = self.Personal.generate_order_money()
        # self.assertEqual(money, '￥44.00元')


    @classmethod
    def tearDownClass(cls) -> None:
        time.sleep(3)
        cls.Personal.quit()


if __name__ == '__main__':
    unittest.main(verbosity=2)

